package shi;
import java.io.IOException;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;


public class ShiMapper extends Mapper<LongWritable, Text, Text, NullWritable> {

    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        // 假设数据以逗号分隔，提取第一列作为key
        String[] columns = value.toString().split(",");
        if (columns.length > 0) { // 确保至少有一列
            context.write(new Text(columns[0]), NullWritable.get());
        }
    }
}
